import { LFindPass, LLoginAccount, LLoginPhone, LRegisterData, LRenewalUser, LSmsCode, InviteUsersRegister } from '@/apiModel/login'
import { HTTP } from '@/utils'
export const upload = (data: any) => {
  return HTTP({ url: '/pub/upload', data, method: 'post' })
}
export const registerUser = (data:LRegisterData) => {
    return HTTP({ url: '/user/register', data, method: 'post', iserror: false })
}

export const loginApi = (data: LLoginAccount | LLoginPhone) => {
  return HTTP({ url: '/auth/login', data, method: 'post' })
}
export const getSmsCode = (data: LSmsCode) => {
  return HTTP({ url: '/pub/sms_code', data, method: 'post' })
}
export const getUserInfo = (data: any = {}) => {
  return HTTP({ url: '/user/info', data, method: 'post' })
}
export const setPassword = (data: LFindPass) => {
  return HTTP({ url: '/auth/find_pass', data, method: 'post' })
}
export const renewalUser = (data: LRenewalUser) => {
  return HTTP({ url: '/user/renewal_user', data, method: 'post', iserror: false })
}
export const inviteUsersRegister = (data: InviteUsersRegister) => {
  return HTTP({ url: '/user/share_register', data, method: 'post', iserror: false })
}

// 用户登录信息
export const authInfo = () => {
  return HTTP({ url: '/auth/info', method: 'post' })
}

// 登录帐号及企业详细信息
export const loginUserInfo = () => {
  return HTTP({ url: '/user/info', method: 'post' })
}

export const userLogOut = (data: any) => {
  return HTTP({ url: '/auth/logout', data, method: 'post' })
}

// 获取公钥
export const getPublicKey = () => {
  return HTTP({ url: '/pub/get_public_key', method: 'get' })
}

// 获取机器码
export const getMachineCode = () => {
  return HTTP({ url: '/auth/get_machine_code', method: 'get' })
}

// 注册注册码
export const registerMachine = (data: any) => {
  return HTTP({ url: '/auth/register_machine', data, method: 'post' })
}